/**************************************************************
Arise Engine		Settings.h

					E-mail:	arise_engine@mail.ru

created:			03.02.2007
last changes:		27.02.2008
**************************************************************/
#pragma once

#include "ConfigTable.h"


#define ARISE_ENGINE_CONFIG_DEFAULT		"config.cfg"
#define LOG_MESSAGE_LENGTH_MAX			512


class Settings
{
private:
	
	ConfigTable		m_main_config;

	void TestWidescreen();

public:
	Settings();
	virtual ~Settings();

	struct SettingsSystem
	{
		HWND			hWnd;
		WNDPROC			message_proc;
		BOOL			window_active;
		std::string		class_name;
		std::string		window_title;
	};

	struct FilePath
	{
		std::string map;
		std::string mesh;
		std::string texture;
		std::string sprite;
		std::string script;
		std::string sound;
		std::string animation;
		std::string screenshot;
		std::string font;
		std::string effect;
	};

	struct KeysSettings
	{
		UINT forward;
		UINT backward;
		UINT stepleft;
		UINT stepright;
		UINT crouch;
		UINT run;
		UINT select;
		UINT jump;
	};

	SettingsSystem		system_settings;
	FilePath			file_path;
	KeysSettings		keys_settings;

	//	engine settings
	bool	is_fullscreen;
	bool	is_vsync;
	UINT	resolution;
	bool	is_widescreen;
	int		window_width;
	int		window_height;
	int		start_window_width;
	int		start_window_height;
	float	fly_speed;
	int		gui_resolution_width;
	int		gui_resolution_height;
	bool	show_console;

	//	renderer settings
	float	fov;
	float	z_near;
	float	z_far;
	UINT	cull_mode;
	int		texture_filter;
	UINT	texture_filter_min;
	UINT	texture_filter_mag;
	UINT	texture_filter_mip;
	bool	is_clear_color;

	virtual bool LoadFromFile(FileData* file);
	virtual void ApplyTextureFilter(const UINT filter_id);
};

void log(const UINT type, const char* string, ...);
void log_vector3(const UINT type, std::string string, D3DXVECTOR3 vector);
void message_box(const char* title, const char* string, ...);
